package com.totem.admin.controller;

import com.totem.admin.api.AdminInfomationServiceApi;
import com.totem.admin.model.TInformation;
import com.totem.admin.service.ITInformationService;
import com.totem.admin.vo.*;
import com.totem.base.model.PageVO;
import com.totem.base.model.Result;
import com.totem.base.mybatis.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Slf4j
@RestController
public class AdminInfomationController extends BaseController<ITInformationService, TInformation> implements AdminInfomationServiceApi {
    @Override
    public Result<FileUrlVO> uploadFileInfoCover(MultipartFile file) throws IOException {
        FileUrlVO vo = service.uploadFileCover(file);
        return Result.success(vo);
    }

    @Override
    public Result<AddInformationVO> addInfomation(AddInformationVO vo) {
        service.addInfomation(vo);
        return Result.success(vo);
    }

    @Override
    public Result<UpdateInformationVO> updateInfomation(UpdateInformationVO vo) {
        service.updateInfomation(vo);
        return Result.success(vo);
    }

    @Override
    public Result<DeleteInformationVO> deleteInfomation(DeleteInformationVO vo) {
        service.deleteInfomation(vo);
        return Result.success(vo);
    }

    @Override
    public Result<PageVO<InformationVO>> infomationPage(InformationPageVO vo) {
        return Result.success(service.infomationPage(vo));
    }
}
